package edos.prm.util;

/**
 * A {@code UID} is a unique process-engine wide identifier.
 * 
 * @version 1.0
 */
public final class UID {
	
	private static int seed = Integer.MIN_VALUE;
	
	private int value;
	
	/**
	 * Create a new unique identifier
	 */
	public UID() {
		value = seed++;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + value;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final UID other = (UID) obj;
		if (value != other.value)
			return false;
		return true;
	}
}
